package ru.urfc.portal.ui.client.renderers;

import ru.urfc.portal.ui.client.descriptor.GridField;

import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.widget.form.Field;

public class ExtInverseFieldRenderer extends ExtFieldRenderer {

	public ExtInverseFieldRenderer(GridField gridField, Field<?> extField) {
		super(gridField, extField);
	}

	@Override
	public void renderElements(ModelData modelData) {
		extField.setValue(!field.<Boolean>getValue(modelData));
	}
	
	@Override
	public void updateModel(ModelData modelData) {
		field.setValue(modelData, !((Boolean)extField.getValue()));
	}
	
}
